// otherTap/pages/Mycollection/Mycollection.js
const app=getApp()
const db =wx.cloud.database()
Page({

  /**
   * 页面的初始数据
   */
  data: {
loading:true,
collectionList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onShow(options) {
    this.getAllData();
    this.setData({
      active:1
    })
  },
getAllData(){
db.collection('collectionurlList').where({
  _openid:app.globalData.openid
}).get().then(res=>{
  console.log(res);
 this.setData({
   collectionList:res.data,
 })
})
this.setData({
  loading:false
})
},
tap(e){
  const item=e.currentTarget.dataset.item;
  console.log(e.currentTarget.dataset.item);
  if(e.currentTarget.dataset.item.type=='技能培训'){
    wx.navigateTo({
      url: `../../../pages/noticeMore/noticeMore?_id=${item.collectionUrl}&title=${'training'}`,
    })
  }else if(e.currentTarget.dataset.item.type=='政策法规'){
    wx.navigateTo({
      url: `../../../pages/administrationDetail/administrationDetail?_id=${item.collectionUrl}`,
    })
  }
},
  onPullDownRefresh() {},
  onReachBottom() {},
  onShareAppMessage() {}
})